package distributed

import (
	protov1 "xagent/proto/v1"

	"github.com/hashicorp/consul/api"
)

// Config represents distributed system configuration
type Config struct {
	Port         int
	NodeName     string
	Address      string
	ConsulAddr   string
	ConsulConfig *api.Config
	Node         *protov1.Node
}

// NewConfig creates a new configuration with defaults
func NewConfig(nodeName string, address string, port int) *Config {
	return &Config{
		Port:         port,
		NodeName:     nodeName,
		Address:      address,
		ConsulAddr:   "localhost:8500",
		ConsulConfig: api.DefaultConfig(),
		Node: &protov1.Node{
			Id:      nodeName,
			Address: address,
			Role:    "agent",
			Status:  protov1.NodeStatus_NODE_STATUS_ACTIVE,
		},
	}
}
